package com.huangmb.androidlib.fragment;

import android.support.v4.app.Fragment;
import com.huangmb.androidlib.utils.ScreenUtils;
import com.huangmb.androidlib.utils.ToastUtils;

/**
 * @author hmb
 * @version 1.0
 * @since 2016/4/16 14:11
 */
public class BaseFragment extends Fragment {

    public float dip2px(float dp) {
        return ScreenUtils.dp2pxFloat(getContext(), dp);
    }

    public float px2dip(float px) {
        return ScreenUtils.px2dpFloat(getContext(), px);
    }

    /**
     * 显示短时间Toast
     * @param msg 内容
     */
    public void toast(String msg){
        ToastUtils.showShort(getContext(),msg);
    }

    /**
     * 显示短时间toast
     * @param id 字符串资源id
     */
    public void toast(int id){
        ToastUtils.showShort(getContext(),id);
    }
}
